package com.yckj.lawyermanager.dongao.service;

import com.yckj.lawyermanager.dongao.entity.Lawyer;
import com.yckj.lawyermanager.dongao.mapper.LawyerMapper;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 律师业务接口实现类
 * @author Jing yaxian
 * @create 2023-01-02 17:19
 */
@Service
public class LawyerServiceImpl implements LawyerService {
    @Autowired(required = false)
    LawyerMapper lawyerMapper;

    /**
     * 修改律师信息
     *
     * @param lawyer 律师对象
     * @return 成功返回1，否则返回0
     */
    @Override
    public int modifyLawyer(Lawyer lawyer) {

        return lawyerMapper.updateLawyer(lawyer);
    }

    /**
     * 按照律师编号查询
     *
     * @param lawyerid 律师编号
     * @return 查询得到的律师对象
     */
    @Override
    public Lawyer findLawyerById(int lawyerid) {
        return lawyerMapper.selectLawyerById(lawyerid);
    }

    @Override
    public int removeLawyer(int lawyerid) {
        return lawyerMapper.deleteLawyer(lawyerid);
    }

    /**
     * 查询所有律师
     *
     * @return 律师集合
     */
    @Override
    public List<Lawyer> findLawyer() {
        return lawyerMapper.selectLawyer();
    }

    /**
     * 添加律师
     *
     * @param lawyer 律师对象
     * @return 添加成功返回
     */
    @Override
    public int addLawyer(Lawyer lawyer) {
        return lawyerMapper.insertLawyer(lawyer);
    }
    /**
     * @description:
     * @return:
     **/
}
